home *** CD-ROM | disk | FTP | other *** search
/ Aminet 30 / Aminet 30 (1999)(Schatztruhe)[!][Apr 1999].iso / Aminet / misc / math / MathFX_src.lha / impress.c < prev    next >
C/C++ Source or Header  |  1995-12-20  |  2KB  |  87 lines

  1. /* This file contains the IMPRESS device dependent subroutines for */
  2. /* use with MathFX. */
  3.  
  4. #include "mathfx.h"
  5. #include <stdio.h>
  6.  
  7. #define SET_HV_SYSTEM   0315
  8. #define OPBYTE1         031
  9. #define OPBYTE2         0140
  10. #define SET_ABS_H       0207
  11. #define SET_ABS_V       0211
  12. #define OPWORDH1        0
  13. #define OPWORDH2        150
  14. #define OPWORDV1        0
  15. #define OPWORDV2        150
  16. #define ENDPAGE         0333
  17.  
  18. static FILE *OutFile;
  19. static int FirstClear=1;
  20.  
  21. /* Open file.  Set up for graphics. */
  22. void impini()
  23. {
  24.       char FileName[80];
  25.  
  26.       printf("Enter file to receive imPRESS graphics commands. ");
  27.       scanf("%s",FileName);
  28.  
  29.       if ((OutFile = fopen(FileName,"w")) == NULL)  {
  30.           printf("Error opening %s \n",FileName);
  31.           exit(1);
  32.       }
  33.       fprintf(OutFile,"@Document(Language ImPress, jobheader off)");
  34.       fprintf(OutFile,"%c%c",SET_HV_SYSTEM,OPBYTE1);
  35.       fprintf(OutFile,"%c%c%c",SET_ABS_H,OPWORDH1,OPWORDH2);
  36.       fprintf(OutFile,"%c%c%c",SET_ABS_V,OPWORDV1,OPWORDV2);
  37.       fprintf(OutFile,"%c%c",SET_HV_SYSTEM,OPBYTE2);
  38. }
  39.  
  40. /* Sets the IMPRESS to text mode */
  41. void imptex()
  42. {
  43. }
  44.  
  45. /* Sets the IMPRESS to graphics mode */
  46. void impgra()
  47. {
  48. }
  49.  
  50. /* Form feed */
  51. void impclr()
  52. {
  53.       if(FirstClear) 
  54.         FirstClear = 0;
  55.       else
  56.         fprintf(OutFile,"%c",ENDPAGE);
  57. }
  58.  
  59. /* May put something here someday */
  60. void impcol(colour)
  61. int colour;
  62. {
  63. }
  64.  
  65. #define CREATE_PATH   0346
  66. #define DRAW_PATH     0352
  67. #define OPTYPE        017
  68. #define COUNT1        0
  69. #define COUNT2        2
  70.  
  71. void implin(x1,y1,x2,y2)
  72. int x1,y1,x2,y2;
  73. {
  74.       fprintf(OutFile,"%c%c%c",CREATE_PATH,COUNT1,COUNT2);
  75.       fprintf(OutFile,"%c%c%c%c",x1/256,x1%256,y1/256,y1%256);
  76.       fprintf(OutFile,"%c%c%c%c",x2/256,x2%256,y2/256,y2%256);
  77.       fprintf(OutFile,"%c%c",DRAW_PATH,OPTYPE);
  78.  
  79. }
  80.       
  81. /* Close graphics file */
  82. void imptid()
  83. {
  84.       fprintf(OutFile,"%c",ENDPAGE);
  85.       fclose(OutFile);
  86. }
  87.